extends Node2D


@export var new_town_center:PackedScene
@export var house:PackedScene
@export var farm:PackedScene
@export var bareckts:PackedScene
@export var range:PackedScene
@export var tower:PackedScene



func _on_button_build_tc_pressed():
	if Global.wood_count >= 50 and Global.gold_count >= 50:
		var new_building = new_town_center.instantiate()
		$"../../GameObjects".add_child(new_building)
		Global.wood_count -= 50
		Global.gold_count -= 50

func _on_button_build_house_pressed():
	if Global.wood_count >= 50:
		var new_building = house.instantiate()
		$"../../GameObjects".add_child(new_building)
		Global.wood_count -= 50


func _on_button_build_bareckts_pressed():
	if Global.wood_count >= 50:
		var new_building = bareckts.instantiate()
		$"../../GameObjects".add_child(new_building)
		Global.wood_count -= 50



func _on_button_build_range_pressed():
	if Global.wood_count >= 50:
		var new_building = range.instantiate()
		$"../../GameObjects".add_child(new_building)
		Global.wood_count -= 50


func _on_button_build_tower_pressed():
	if Global.wood_count >= 50:
		var new_building = tower.instantiate()
		$"../../GameObjects".add_child(new_building)
		Global.wood_count -= 50


func _on_button_build_farm_pressed():
	if Global.wood_count >= 50:
		var new_building = farm.instantiate()
		$"../../GameObjects".add_child(new_building)
		Global.wood_count -= 50
